home *** CD-ROM | disk | FTP | other *** search
/ Over 1,000 Windows 95 Programs / Over 1000 Windows 95 Programs (Microforum) (Disc 1).iso / 1244 / procbox.h < prev    next >
C/C++ Source or Header  |  1996-06-17  |  22KB  |  520 lines

  1. #include <windows.h>                            
  2. ///////////////////////////////////////////////////////////////////////////////////////////////////
  3. //
  4. //
  5. //    PROCBOX.H        Defines and function declarations for ProcessBox
  6. //
  7. //        VERSION 2.00
  8. //
  9. //    ** OVERVIEW **
  10. //
  11. //     PROCBOX.DLL provides a simple way to implement time-consuming processing steps (I call these
  12. //        "Processes" in the rest of this file) which the end-user may wish to cancel.  As a programmer, 
  13. //        you provide an "_exported" callback    function (the Process Box Callback, PBCALLBACK) which 
  14. //        performs actions in response to messages sent to it by PROCBOX.DLL.            
  15. //
  16. //        PROCBOX provides a dialog box    which displays a graphical %done gauge indicator and a 
  17. //        CANCEL button.
  18. //    
  19. //    ** ABOUT PBCALLBACK **
  20. //        PBCALLBACK is an _exported callback which you write.  PBCALLBACK can be implemented 
  21. //        with a switch statement - similarly to other standard Windows callbacks. Like Windows
  22. //        Hook callbacks, the switch variable is called iCode.  There are iCodes (detailed below)
  23. //        which signal initialization, deinitialization, processing and cancellation.
  24. //
  25. //        One of the important functions of PBCALLBACK is to perform a small chunk of the Process
  26. //        (eg., reading a big file from disk) when it is sent a PBC_PROCESS code.  Between 
  27. //        processing of the PBC_PROCESS code, multiprocessing can occur.  The PBC_PROCESS message 
  28. //        will be sent repeatedly until 
  29. //                    (1) PBCALLBACK returns PBCR_END or PBCR_ERROR
  30. //                    (2) User presses "CANCEL" (in standard ProcessBox), OR
  31. //                    (3) Custom Process Dialog Box Procedure calls SetCancelState(hwndPB, TRUE)
  32. //
  33. //    You should never call PBCALLBACK yourself.  This is handled behind the scenes in
  34. //        the ProcessBox(Ex), RunProcess or IterateProcess APIs.  (In fact ProcessBox(Ex)
  35. //        calls the lower-level function, RunProcess. RunProcess in turn calls the
  36. //        lowest-level API, IterateProcess.) 
  37. //
  38. //                REPEAT: NEVER CALL PBCALLBACK YOURSELF!
  39. //
  40. //    ** APPLICATION PROGRAMMING INTERFACE **
  41. //
  42. //        Several API functions provide a flexible interface 
  43. //        for accessing the Process Dialog Box. There are three 
  44. //        methods for implementing Process Box.  They are listed 
  45. //        below in increasing complexity.  
  46. //        
  47. //        The first two implement modal dialog boxes.  The calling 
  48. //        application will halt until the process is complete (like 
  49. //        calling MessageBox).  The first two methods disable
  50. //        the owner window (and child windows) and setup their own 
  51. //        PeekMessage loop (inside PROCBOX.DLL) and send PBC_PROCESS
  52. //        messages between calls to PeekMessage.
  53. //
  54. //        The last method access Process Box as a modeless dialog
  55. //        (ie., PROCBOX.DLL does not implement the message loop)
  56. //        You are responsible for calling IterateProcess, the function
  57. //        which allows the dialog to process a chunk of the Process.
  58. //        Using the last method you could, for example, 
  59. //        cause processing to occur in response to WM_TIMER messages 
  60. //        or within your own custom PeekMessage loop.
  61. //
  62. //        (1) Single Callback Modal     - One simple function call.  
  63. //                                            - Only one Callback/Process Box
  64. //                                            - Process Box is destroyed after
  65. //                                                Process is finished.
  66. //
  67. //        (2) Multiple Callback Modal- Requires several function calls.  
  68. //                                - Several Callbacks can be used (sequentially) with 
  69. //                                    one Process Box. 
  70. //                                    You handle Process Box creation/destruction.
  71. //                                
  72. //        (3) Low-level        - can be used to implement several multiprocessed Process Boxes
  73. //                                    in a single application environment
  74. //                                - you must provide the IsDialogMessage() handlers for each process
  75. //                                    box in your message loop and call IterateProcess to
  76. //                                    process each chunk of the PBCALLBACK Process.
  77. //
  78. //        Single Callback Modal Interface:
  79. //        --------------------------------
  80. //                            ProcessBox
  81. //                            ProcessBoxEx
  82. //
  83. //        The ProcessBox and ProcessBoxEx functions are similar to the MessageBox Windows API.  
  84. //        Program execution halts at ProcessBox(Ex) and does not return until the process 
  85. //        has completed.    
  86. //
  87. //        Multiple Callback Modal Interface: 
  88. //        ---------------------------------- 
  89. //                            CreateProcessBox    *
  90. //                            AttachProcess        *
  91. //                            RunProcess
  92. //                            DestroyProcessBox    *
  93. //
  94. //                            (* also used in Low-Level Interface)
  95. //
  96. //        The functions used in this method expose a lower level of the interface for 
  97. //        Process Box.  In fact, the Single Callback Modal method is a wrapper around these functions.
  98. //        By directly using these functions (in the order listed).  You can create several
  99. //        Process Boxes, attach different callbacks to them, and start them running.
  100. //        Alternatively, you can create a single process box and attach and run
  101. //        several different callbacks (sequentially) using a series of AttachProcess/RunProcess
  102. //        calls.  After you're done, call DestroyProcessBox.    
  103. //        Note: calling RunProcess suspends execution of the calling app in the same
  104. //        way that ProcessBox(Ex) does.
  105. //
  106. //        Low-Level (Multiple Callback Modeless) Interface: 
  107. //        -------------------------------------------------
  108. //                        Multiple Modal Interface Functions (-RunProcess)
  109. //                        IterateTaskProcesses
  110. //                        IterateProcess              *
  111. //                        GetProcessBoxFirst        *
  112. //                        GetProcessBoxNext            *
  113. //                        IsProcessMessage
  114. //
  115. //        * IterateTaskProcesses calls IterateProcess and GetProcessBoxFirst/Next for you
  116. //            you shouldn't have to use these functions if you call IterateTaskProcesses
  117. //
  118. //        The low-level interface uses all of the functions listed above in Multiple Callback Modal 
  119. //        Interface except for RunProcess.  Instead, you should use the IterateProcess 
  120. //        function to call send a PBC_PROCESS code to PBCALLBACK and respond appropriately 
  121. //        to the callback responses. (ie., drawing the Gauge indicator, changing the Title 
  122. //        caption, etc.).  In fact, RunProcess is nothing more than a PeekMessage loop 
  123. //        which contains a call to IterateProcess.  
  124. //
  125. //        The return value from IterateProcess indicates whether processing is NOT done
  126. //        (PI_CONTINUE), processing IS done (PI_END), an error occurred (PI_PROCESSERROR), 
  127. //        or cancel was pressed (PI_CANCEL).  You'll have to provide code to handle this and
  128. //        call IterateProcess again (if necessary).  When the process is done or failed
  129. //        call DestroyProcessBox.
  130. //
  131. //        Note: IterateProcess sends the PBC_CANCEL messages to the CALLBACK when
  132. //            necessary. You should not do this yourself!
  133. //
  134. //
  135. //        Custom Process Box Interface:
  136. //        -----------------------------
  137. //                    CustomProcessBox     - analogous to DialogBox.  Creates a modal custom process box
  138. //                    CustomProcessBoxParam    - analogous to DialogBoxParam
  139. //                    CreateCustomProcessBox    - analogous to CreateDialog
  140. //                    CreateCustomProcessBoxParam - analogous to CreateDialogParam
  141. //                    SetCancelState                - used inside a Custom Process Box procedure to indicate
  142. //                                                    that the process should be canceled
  143. //
  144. //////////////////////////////////////////////////////////////////////////////////////////////////
  145.  
  146. /////////////////////////////////////////////////////////////////////////////////////////////////
  147. //
  148. //
  149. //    Process box function declarations:
  150. //                                   
  151. //                     
  152. //
  153. ////////////////////////////////////////////////////////////////////////////////////////////////
  154.  
  155.  
  156. ///////////////////////////////////////////////////////////////////////////////
  157. //
  158. //    SINGLE CALLBACK MODAL INTERFACE FUNCTIONS:
  159. //
  160. //
  161. //
  162.     
  163.     //
  164.     //    ProcessBoxEx - Single-step, easy to use API.
  165.     //                        Handles all the functions to setup/destroy the process dialog box
  166.     //                        and start/finish a process.  
  167.     //                        Returns when the process is complete, cancelled or an error occurs.
  168.     //                
  169.     //    RETURNS:                         
  170.     //            PBE_OK (on successful completion) or
  171.     //            PBE_<ERRORCODE> (see below)
  172.     //
  173.  
  174. #ifndef _INC_PROCESSBOX    
  175.  
  176. #ifdef __cplusplus
  177. extern "C" {
  178. #endif
  179.  
  180. extern int CALLBACK ProcessBoxEx(    HWND,         // hwnd - owner window
  181.                                         LPSTR,         // lpszTitle - Title bar text
  182.                                         LPSTR,         // lpszMessage - only used if PB_MESSAGE is set in wFlags
  183.                                         UINT,         // Xpos - screen coordinate. Only used if PB_CENTER is NOT set in wFlags.
  184.                                         UINT,         // Ypos - screen coordinate. Only used if PB_CENTER is NOT set in wFlags.
  185.                                         FARPROC,     //    Procedure-Instance address of user-defined CALLBACK (returned by MakeProcInstance)
  186.                                         LPARAM,        //    lUserData - user-defined data.                                                         
  187.                                         WORD) ;        // wFlags - control behaviour of ProcessBox
  188.     //    
  189.     //    ProcessBox - 
  190.     //     Simplified wrapper around ProcessBoxEx.
  191.     //        "default" behaviour: wFlags = PB_CENTER, lpUserData=NULL    
  192.     //
  193. extern int CALLBACK ProcessBox(    HWND,         // hwnd - owner window
  194.                                             LPSTR,         // lpszTitle - Title bar text
  195.                                             FARPROC);     //    Procedure-Instance address of user-defined CALLBACK (returned by MakeProcInstance)
  196.  
  197. ///////////////////////////////////////////////////////////////////////////
  198. //
  199. //        MULTIPLE CALLBACK MODAL INTERFACE FUNCTIONS:
  200. //
  201. //
  202. //
  203. //
  204.  
  205.  
  206.     //
  207.     //    CreateProcessBox - Creates and initializes the process dialog box    
  208.     //    RETURNS:    window handle of dialog box or NULL on error
  209.     //
  210. extern HWND CALLBACK CreateProcessBox(    
  211.                             HWND,         // hwnd - owner window
  212.                             LPSTR,         // lpszTitle - Title bar text
  213.                             LPSTR,         // lpszMessage - only used if PB_MESSAGE is set in wFlags
  214.                             UINT,         // Xpos - screen coordinate. Only used if PB_CENTER is NOT set in wFlags.
  215.                             UINT,         // Ypos - screen coordinate. Only used if PB_CENTER is NOT set in wFlags.
  216.                             WORD) ;        // wFlags - control behaviour of ProcessBox    
  217.     //
  218.     //    AttachProcess     - Attaches a user-defined callback procedure to a dialog box
  219.     //                        - If a process is already attached to this dialog box, it is
  220.     //                            sent a PBC_CLOSE code before the new process is attached.
  221.     //
  222.     //    Notes:    Use AttachProcess(hwndPB, NULL); to close the existing process
  223.     //
  224.     //    RETURNS: PBE_INVALIDHANDLE (process box handle was invalid)
  225.     //                PBE_CLOSE (previous callback had error closing)
  226.     //                PBE_OPEN (new callback couldn't open)
  227.     //                PBE_OK 
  228.     //
  229. extern int CALLBACK    AttachProcess( 
  230.                             HWND,            // hwndPB - handle of process box to attach callback to
  231.                             FARPROC,        // PBCallback - procedure-instance (MakeProcInstance) of _exported Callback function
  232.                             LPARAM);     // lUserData - User data 
  233.  
  234. #define DetachProcess(x) AttachProcess(x,NULL,NULL)
  235.  
  236.     //
  237.     //    DestroyProcessBox - Closes the attached callback and destroys the Process Dialog Box
  238.     //    RETURNS: PBE_CLOSE 
  239.     //                PBE_OK
  240.     //
  241. extern int CALLBACK DestroyProcessBox(HWND /*- hwndPB*/);
  242.  
  243.     //
  244.     //    RunProcess - Sets up a PeekMessage loop and starts sending PBC_PROCESS
  245.     //                        messages to the callback.                    
  246.     //
  247.     //    PARAMETERS:
  248.     //        HWND hwndPB - a valid handle returned by CreateProcessBox
  249.     //
  250.     //    RETURNS: 
  251.     //            PBE_OK, PBE_CANCEL, PBE_PROCESS
  252.     //
  253. extern int CALLBACK RunProcess(HWND); // phwndPB - the process box to run
  254.  
  255. /////////////////////////////////////////////////////////////////////
  256. //
  257. //        LOW-LEVEL INTERFACE FUNCTIONS:
  258. //
  259. //
  260. //
  261. //                                  
  262.  
  263.     //
  264.     //    IterateProcess    - Sends one PBC_PROCESS code the PBCALLBACK
  265.     //                            - Responds to PBCALLBACK Response Codes (PBCR_XXXXX)
  266.     //    RETURNS:
  267.     //            PI_CONTINUE            - processing is incomplete
  268.     //            PI_END                - process completed OK 
  269.     //            PI_PROCESSERROR    - callback returned an error
  270.     //            PI_CANCEL            - user canceled operation
  271.     //    
  272. extern int CALLBACK IterateProcess(HWND ); // hwndPB - Process Box to iterate
  273.  
  274.     //
  275.     //    GetProcessBoxFirst - Returns the first Process Box in the current task's list
  276.     //                (This list is maintained by PROCBOX.DLL)    
  277.     //
  278.     //    RETURNS: hwndPB - handle of first Process Box
  279.     //                NULL - failure
  280.     //
  281. extern HWND CALLBACK GetProcessBoxFirst();
  282.  
  283.     //
  284.     //    GetProcessBoxNext - Given a valid Process Box handle (returned by
  285.     //                        CreateProcessBox), returns the next Process Box in the list
  286.     //
  287.     //    RETURNS: hwndPB - next Process Box
  288.     //                NULL - failure
  289.     //
  290. extern HWND CALLBACK GetProcessBoxNext(HWND);    // hwndPB - Current process box handle 
  291.  
  292.     //
  293.     //    IsProcessMessage - Like IsDialogMessage, but for ProcessBoxes
  294.     //                        Determines if the message is for the given HWND
  295.     //                        and if the HWND is a ProcessBox.  If it is, then
  296.     //                        the message is dispatched.
  297.     //
  298.     //    NOTE:    Passing NULL as hwndPB allows you to check whether the Message
  299.     //        is for any of the available Process Boxes
  300.     //    
  301.     //    RETURNS: TRUE - message was a Process Box message and was dispatched
  302.     //                FALSE - not a Process Box message
  303.     //
  304. extern BOOL    CALLBACK IsProcessMessage(HWND,         // hwndPB - the PRocess Box to check
  305.                                                 MSG far *);    // lpmsg  - MSG struct (returned from PeekMessage or GetMessage)
  306.  
  307.  
  308.     //
  309.     //    IterateTaskProcesses 
  310.     //                - Loops once through all the ProcessBoxes in the current task
  311.     //                            and calls IterateProcess for each.
  312.     //                - If IterateProcess return != PI_CONTINUE, then the loop stops
  313.     //                    IterateProcess returns hwndPB (process box which caused the break)
  314.     //                    and pState = the return value from IterateProcess
  315.     //
  316.     //        IterateTaskProcesses calls GetProcessBoxFirst, GetPRocessBoxNext,
  317.     //                and IterateProcess for you.  You should not have to use
  318.     //                these functions if you call IterateProcess in a message loop.
  319.     //
  320.     // RETURNS:      
  321.     //            hwndPB - handle of last Process Box to be iterated 
  322.     //                        or NULL if no process boxes exist in the current task
  323.     //            (NOTE: hwndPB not necessarily = last Process Box in the task's list
  324.     //                    since the loop can break if one of the processes has an error, 
  325.     //                    is cancelled or ends).
  326.     //                    
  327.     //    RETURN PARAMETER: *lpState = IterateProcess return value
  328.     //        - if hwndPB != NULL,
  329.     //                *lpState = PI_CONTINUE (IterateProcess returned PI_CONTINUE for all ProcessBoxes)
  330.     //                        or PI_????? (Loop stopped at hwndPB)
  331.     //        - if hwndPB == NULL, *lpState = NULL
  332.     
  333. extern HWND CALLBACK IterateTaskProcesses(int far *);
  334.  
  335. /////////////////////////////////////////////////////////////////////////
  336. //
  337. //    CUSTOM PROCESS BOX INTERFACE FUNCTIONS:
  338. //        
  339. //
  340. //
  341.  
  342.     //
  343.     //    CustomProcessBox    - Runs a custom modal Process Dialog Box
  344.     //                            - very similar to a call to DialogBox
  345.     //                       - first four parameters are identical to DialogBox
  346.     //
  347.     //    RETURNS: Same as ProcessBox(Ex) 
  348.     //
  349. extern int CALLBACK CustomProcessBox(     HINSTANCE,    // instance handle of module which contains the dialog template
  350.                                                     LPCSTR,       // address of dialog box template name
  351.                                                     HWND,            // handle of owner window
  352.                                                     FARPROC,        // procedure-instance handle of dialog callback function
  353.                                                     FARPROC,        // procedure-instance handle of process callback function
  354.                                                     LPARAM);        // lUserData - user data
  355.  
  356.     //
  357.     //    CustomProcessBoxParam    - Runs a custom modal Process Dialog Box
  358.     //                                    - analogous to DialogBox
  359.     //                               - first five parameters are identical to DialogBoxParam
  360.     //
  361.     //    RETURNS: Same as ProcessBox(Ex)
  362.     //
  363. extern int CALLBACK CustomProcessBoxParam(HINSTANCE,    // hinst - instance handle of module which contains the dialog template
  364.                                                     LPCSTR,       // lpszDlgTemplate - address of dialog box template name
  365.                                                     HWND,            // hwndOwner - handle of owner window
  366.                                                     FARPROC,        // dlgproc - procedure-instance handle of dialog callback function
  367.                                                     LPARAM,        // lParamInit - user-data (passed as LPARAM during WM_INITDIALOG)
  368.                                                     FARPROC,        // procedure-instance handle of process callback function                                                    
  369.                                                     LPARAM);        // lUserData - user data
  370.  
  371.     //
  372.     //    CreateCustomProcessBox    - Creates a custom process box using a 
  373.     //                                        a custom dialog template and dialog box procedure
  374.     //                                    - analogous to CreateDialog
  375.     //
  376.     //    RETURNS:
  377.     //        hwndPB, window handle of Custom Process Box
  378.     //    or NULL, failure
  379.     //    
  380. extern HWND CALLBACK CreateCustomProcessBox(
  381.                                 HINSTANCE,    // hinst - instance handle of module which contains the dialog template
  382.                                 LPCSTR,       // lpszDlgTemplate - address of dialog box template name
  383.                                 HWND,            // hwndOwner - handle of owner window
  384.                                 FARPROC);        // dlgproc - procedure-instance handle of dialog callback function                                
  385.     
  386.     //
  387.     //    CreateCustomProcessBoxParam    - Creates a custom process box using a 
  388.     //                                        a custom dialog template and dialog box procedure
  389.     //                                    - analogous to CreateDialogParam
  390.     //    RETURNS:
  391.     //        hwndPB, window handle of Custom Process Box
  392.     //    or NULL, failure
  393.     //    
  394. extern HWND CALLBACK CreateCustomProcessBoxParam(
  395.                                 HINSTANCE,    // hinst - instance handle of module which contains the dialog template
  396.                                 LPCSTR,       // lpszDlgTemplate - address of dialog box template name
  397.                                 HWND,            // hwndOwner - handle of owner window
  398.                                 FARPROC,        // dlgproc - procedure-instance handle of dialog callback function
  399.                                 LPARAM);        // lParamInit - user-data (passed as LPARAM during WM_INITDIALOG)                                
  400.     
  401. extern BOOL CALLBACK SetCancelState(
  402.                                 HWND,    // hwndPB - handle of Custom Process Box 
  403.                                 BOOL);    // bCancel - set to TRUE to cause cancellation of process                                    
  404.     
  405.     
  406. //////////////////////////////////////////////////////////////////////////////
  407. //////////////////////////////////////////////////////////////////////////////
  408. ////
  409. ////
  410. ////        END OF PROCESS BOX API FUNCTION DECLARATIONS
  411. ////
  412. ////
  413. ////
  414. //////////////////////////////////////////////////////////////////////////////
  415. //////////////////////////////////////////////////////////////////////////////    
  416.     //                        
  417.     //    ProcessBox Flags:
  418.     //
  419. #define    PB_CENTER    0x0001       // centers Process box with respect to owner
  420. #define    PB_MESSAGE    0x0002        //    enables the message display window
  421. #define    PB_HIDE        0x0004        // prevents the box from being shown (in ProcessBox(Ex)/CreateProcessBox)
  422. #define    PB_NOOWNERDISABLE    0x0008    // prevents default owner disabling behaviour
  423.                                                 //  (in ProcessBox(Ex) and RunProcess)
  424. //
  425. //        ProcessBox CALLBACK iCodes (PBC_XXXXXX):
  426. //            These values are sent to the user-defined CALLBACK
  427. //            to indicate startup, processing, cancelation and closing    
  428. //
  429. #define    PBC_OPEN        1        //    Indicates startup. 
  430.                                     //    CALLBACK should allocate memory and initialize
  431.                                     //        variables and return success/failure.
  432.                                     //        Failure will abort the process. 
  433.                                     //        No more messages will be sent to the CALLBACK.
  434.                                     //
  435.                                     //    RETURN: TRUE (success), FALSE (failure)
  436.                                     
  437. #define    PBC_CLOSE    2        //    Indicates end of operation or destruction of ProcessBox.
  438.                                     // CALLBACK should free any memory it allocated (in PBC_OPEN)
  439.                                     //        and return TRUE.  Returning false will cause
  440.                                     //        ProcessBox(Ex) and AttachProcess to return PBE_CLOSE (error during closing)
  441.                                     //
  442.                                     //    NOTES: PBCallback is guaranteed to receive only 1 PBC_CLOSE 
  443.                                     //                code for each PBC_OPEN code.
  444.                                     //            PBC_CLOSE is generated 
  445.                                     //                1) After PBCallback returns PBCR_END or PBCR_ERROR
  446.                                     //                2) After PBCallback returns TRUE in response to
  447.                                     //                            PBC_CANCEL
  448.                                     //                3) When AttachProcess(hwndPB, NULL, NULL) is called
  449.                                     //                        = (DetachProcess(hwndPB))                                    
  450.                                     //                5) When the ProcessBox is destroyed. 
  451.                                     //                        (eg.,DestroyWindow, DestroyProcessBox, application exit).
  452.                                     //            
  453.                                     //    RETURN : TRUE, FALSE                                                                
  454.                                     
  455. #define    PBC_CANCEL    3        // Indicates that Cancel button was pressed                                    
  456.                                     //    RETURN:     TRUE = OK to Cancel (PBC_CLOSE will be sent), 
  457.                                     //                FALSE    = Continue operation (PBC_PROCESS will be sent)
  458.                                                                         
  459. #define    PBC_PROCESS    4        // Indicates that processing should occur.
  460.                                     //    CALLBACK should process a small chunk of the Process and 
  461.                                     //        return a Process Box CALLBACK Response    
  462.                                     //
  463.                                     //    RETURN:     PBCR_ERROR = Indicates an error has occurred. 
  464.                                     //                                PBC_CLOSE will be sent.
  465.                                     //                PBCR_END = Finished processing normally. 
  466.                                     //                                PBC_CLOSE will be sent.                                                                        
  467.                                     //                PBCR_CONTINUE = Processing isn't finished
  468.                                     //                                PBC_PROCESS will be sent.
  469.  
  470. //
  471. //
  472. //    Process Box CALLBACK Responses 
  473. //        responses to the PBC_PROCESS iCode (see above).
  474. //
  475. #define PBCR_ERROR            -1
  476. #define PBCR_END                0
  477. #define PBCR_CONTINUE        1
  478.  
  479.  
  480. //
  481. //
  482. //    Process Box Error Codes:
  483. //        These values are returned by Process Box APIs
  484. //        IterateProcess has its own return codes (see below)
  485. //
  486.  
  487. #define PBE_OK                0            // Function worked!
  488. #define PBE_OPEN            -1            // callback error during PBC_OPEN
  489. #define PBE_PROCESS        -2            // callback error PBC_PROCESS handling
  490. #define PBE_CLOSE            -3            // callback error during PBC_CLOSE handling
  491. #define PBE_CANCEL        -4            // user pressed CANCEL
  492. #define PBE_CREATE        -5            // failed to create Process Dialog Box
  493. #define PBE_INVALIDHANDLE -6        // the handle to hwndPB was invalid or callback was invalid
  494.  
  495.  
  496. //
  497. //    IterateProcess return values:
  498. //                                
  499. #define PI_CONTINUE            1
  500. #define PI_END                    0
  501. #define PI_PROCESSERROR    -2
  502. #define PI_CANCEL                -4  
  503. #define PI_INVALIDHANDLE    -6
  504.  
  505.  
  506. //
  507. //    Messages for Custom Process Box procedures
  508. //
  509. #define PM_SETGAUGE    WM_USER+1    // WPARAM = iPercent (>=0, <=100)
  510. #define PM_SETMESSAGE WM_USER+2    // LPARAM = LPSTR lpszText
  511.  
  512. #define _INC_PROCESSBOX
  513. #ifdef __cplusplus
  514. }    // end #ifdef __cplusplus
  515. #endif
  516. #endif // #ifndef PROCESSBOX
  517.  
  518.  
  519.  
  520.